package  
{
	import net.flashpunk.Entity;
	import net.flashpunk.graphics.Spritemap;
	import net.flashpunk.FP;
	/**
	 * ...
	 * @author Anthony
	 */
	public class Fly2 extends Entity {
		private var fly2Sprite:Spritemap = new Spritemap(Assets.FLY2_SPRITE, 16, 16);
		public var level:int;
		
		public function Fly2(theLevel:int) {
			level = theLevel;
			fly2Sprite.add("fly", [0,1,2,1], 20, true);
			graphic = fly2Sprite;
			fly2Sprite.play("fly");
			type = "fly2";
			setHitbox(48, 48, 16, 16);
			layer = 1;
			var dataList:XMLList;
			var dataElement:XML;
			dataList = GameEngine.levelXML[theLevel].bugs.fly2;
			for each(dataElement in dataList) {
				x = dataElement.@x;
				y = dataElement.@y;
			}
		}
		override public function update():void {
			if (GameEngine.level == level && collide("fracas", x , y)) {
				GameEngine.fly2Dialogue.visible = true;
				GameEngine.fly2Dialogue.x = (x +8) - (GameEngine.fly2Dialogue.theText.width / 2);
				GameEngine.fly2Dialogue.y = y - 25;
			}else {
				GameEngine.fly2Dialogue.visible = false;
			}
		}		
	}

}